package com.android.djlmapp.dialog;

import android.content.Context;
import android.text.style.LineHeightSpan;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import com.android.djlmapp.R;

import razerdp.basepopup.BasePopupWindow;

public class ShaiXuanPopup extends BasePopupWindow {
    public static int mHeight;
    public ShaiXuanPopup(Context context) {
        super(context);
    }

    public static void setHei(int height){
        mHeight = height;
    }

    // 必须实现，这里返回您的contentView
    // 为了让库更加准确的做出适配，强烈建议使用createPopupById()进行inflate
    @Override
    public View onCreateContentView() {
        View view = createPopupById(R.layout.duizhang_popup);
        LinearLayout layout = view.findViewById(R.id.shaixuan);

        Log.i("djlm-my", "height: " + mHeight);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        params = (FrameLayout.LayoutParams)layout.getLayoutParams();
        params.setMargins(0, mHeight, 0, 0);//left,top,right,bottom
        layout.setLayoutParams(params);

        return view;
    }

    // 以下为可选代码（非必须实现）
    // 返回作用于PopupWindow的show和dismiss动画，本库提供了默认的几款动画，这里可以自由实现
    @Override
    protected Animation onCreateShowAnimation() {
        return getDefaultScaleAnimation(true);
    }

    @Override
    protected Animation onCreateDismissAnimation() {
        return getDefaultScaleAnimation(false);
    }
}
